package router

import (
	"gin-template/api"
	"gin-template/middleware"

	"github.com/gin-gonic/gin"
)

func InitRouter() *gin.Engine {
	r := gin.Default()

	// 简单的路由组: v1
	v1 := r.Group("/api/auth")
	{
		v1.POST("/login", api.Login)
		v1.POST("/register", api.Register)
	}

	v2 := r.Group("/api/auth", middleware.AuthMiddleWare())
	{
		v2.GET("/logined_test", api.LoginedTest)
	}
	return r
}
